package org.adorsys.aderp.cash.domain;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.entity.RooJpaEntity;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooJpaEntity
public class CashReceipt implements Serializable {

    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@NotNull
    @Column(name = "cashReceiptKeyBk", unique = true)
    private String cashReceiptKey;

    @NotNull
    @Column(unique = true)
    private String receiptNumber;

    @NotNull
    private BigDecimal totalPurchase;

    @NotNull
    private BigDecimal tax;

    @NotNull
    private BigDecimal gratuity;

    @NotNull
    private BigDecimal amountDue;

    @NotNull
    private BigDecimal amountIn;

    @NotNull
    private BigDecimal amountOut;

    @ManyToOne
    private PaymentType paymentType;

    @ManyToOne
    private CashRegister cashRegister;

    @NotNull
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(pattern = "dd-MM-yyyy HH:mm:ss")
    private Date cashDate;

    private String recordOwner;

    private String cashier;

    private String approvedBy;

    @OneToMany(cascade = CascadeType.ALL)
    private Set<CashRegItem> cashRegItems = new HashSet<CashRegItem>();
}
